let t = require;
let e = module;
let o = e.exports;
o.default = e.exports;

('use strict');
console.log('start');
var _n64,
  i =
    (this && this.__extends) ||
    ((_n64 = function n(t, e) {
      return (_n64 =
        Object.setPrototypeOf ||
        ({
          __proto__: []
        } instanceof Array &&
          function (t, e) {
            t.__proto__ = e;
          }) ||
        function (t, e) {
          for (var o in e) {
            Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
          }
        })(t, e);
    }),
    function (t, e) {
      function o() {
        this.constructor = t;
      }
      _n64(t, e),
        (t.prototype =
          null === e
            ? Object.create(e)
            : ((o.prototype = e.prototype), new o()));
    });
Object.defineProperty(o, '__esModule', {
  value: !0
}),
  (o.CardType2Com = void 0);
var r = t('UIComponent'),
  a = t('ComUtils'),
  s = t('ResMrg'),
  c = t('BagMrg'),
  l = t('AbsInfo'),
  u = t('BattleUtils'),
  h = t('SoundMrg'),
  p = t('UIMrg'),
  f = t('CardUpgradePanel'),
  d = t('LangCfg'),
  g = (function (t) {
    function e(e, o) {
      var n = t.call(this, e) || this;
      return (n.info = o), n;
    }
    return (
      i(e, t),
      (e.prototype.onInit = function () {
        (this._imgFrame = a.default.getComponent(
          cc.Sprite,
          this.view,
          'imgCard'
        )),
          (this._imgIcon = a.default.getComponent(
            cc.Sprite,
            this.view,
            'imgCard/imgIcon'
          )),
          (this._imgQuality = a.default.getComponent(
            cc.Sprite,
            this.view,
            'imgCard/imgQuality'
          )),
          (this._pbBar = a.default.getComponent(
            cc.ProgressBar,
            this.view,
            'imgCard/progress'
          )),
          (this._txtCount = a.default.getComponent(
            cc.Label,
            this.view,
            'imgCard/progress/txtCount'
          )),
          (this._txtLevel = a.default.getComponent(
            cc.Label,
            this.view,
            'imgCard/txtLevel'
          )),
          (this._txtName = a.default.getComponent(
            cc.Label,
            this.view,
            'imgCard/txtName'
          )),
          (this._txtManJi = a.default.getComponent(
            cc.Label,
            this.view,
            'imgCard/txtManJi'
          )),
          (this._upgradeTips = a.default.getNode(
            this.view,
            'imgCard/progress/upgradeTips'
          ));
      }),
      (e.prototype.onLang = function () {
        (a.default.getComponent(
          cc.Label,
          this.view,
          'imgCard/txtManJi'
        ).string = d.LangCfg.ins.getContent(1019)),
          this._info &&
            (this._txtName.string = d.LangCfg.ins.getContent(this._info.name));
      }),
      (e.prototype.onTouchEvenHandler = function (t) {
        t.type == cc.Node.EventType.TOUCH_END &&
          (h.SoundMrg.click(), p.UIMrg.show(f.CardUpgradePanel, this.info));
      }),
      Object.defineProperty(e.prototype, 'info', {
        get: function get() {
          return this._info;
        },
        set: function set(t) {
          this._info != t &&
            (this._info &&
              c.BagMrg.ins.removeCountEvent(
                this._info.itemId,
                this.refreshOther,
                this
              ),
            t &&
              (t.on(l.InfoEvent.LevelChanged, this.refreshOther, this),
              c.BagMrg.ins.addCountEvent(t.itemId, this.refreshOther, this)),
            (this._info = t),
            this.refreshCard());
        },
        enumerable: !1,
        configurable: !0
      }),
      (e.prototype.refreshCard = function () {
        var t = this._txtName.node.getComponent(cc.LabelOutline);
        s.ResMrg.loadSpriteByAtlas(
          this._imgFrame,
          'Atlas/Card',
          'frame' + this._info.quality
        ),
          s.ResMrg.loadSpriteByAtlas(
            this._imgIcon,
            'Atlas/Card',
            this._info.icon
          ),
          s.ResMrg.loadSpriteByAtlas(
            this._imgQuality,
            'Atlas/Card',
            'quality' + this._info.quality
          ),
          (t.color = cc.Color.fromHEX(
            t.color,
            u.default.CardNameOutLineColors[this.info.quality]
          )),
          this.onLang(),
          this.refreshOther();
      }),
      (e.prototype.refreshOther = function () {
        if (
          ((this._txtLevel.string = 'Lv.' + this._info.level),
          this._info.isMaxLevel)
        )
          (this._pbBar.node.active = !1), (this._txtManJi.node.active = !0);
        else {
          var t = c.BagMrg.ins.getCount(this._info.itemId);
          (this._upgradeTips.active = t >= this._info.itemCount),
            (this._txtCount.string =
              Math.min(t, this._info.itemCount) + '/' + this._info.itemCount),
            cc
              .tween(this._pbBar)
              .to(0.1, {
                progress: Math.min(t / this._info.itemCount, 1)
              })
              .start(),
            (this._pbBar.node.active = !0),
            (this._txtManJi.node.active = !1);
        }
      }),
      e
    );
  })(r.UIComponent);
(o.CardType2Com = g), console.log('end');
module.exports = e.exports;
